--[[
编码: WMS-38-24
名称: 任务-PDA-任务显示HTML页面
作者:HAN
日期:2025-1-29
级别:项目
函数: GenerateViewHTML
功能:
生产一个任务对象属性显示页面的HTML
TA240318-00005
要求包括任务搬运容器里的物料,批次号等属性
更改记录:
--]]
wms_wh = require( "wms_wh" )
local function gen_attr_div_html( attr_name, attr_value )
local str_html = ''
str_html = str_html..''..attr_value..'
'
return str_html
end
function GenerateViewHTML ( strLuaDEID )
local nRet, strRetInfo, strErr
local task
local str_html = ""
nRet, task = m3.GetSysCurEditDataObj(strLuaDEID,"Task")
-- 生成HTML
str_html = gen_attr_div_html( "任务编码", task.code )
str_html = str_html..gen_attr_div_html( "作业编码", task.op_code )
str_html = str_html..gen_attr_div_html( "作业名称", task.op_name )
str_html = str_html..gen_attr_div_html( "容器编码", task.cntr_code )
-- 获取容器里的物料
local cg_detail
nRet, cg_detail = wms_cntr.Get_Container_Goods( strLuaDEID, task.cntr_code )
if (nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "WMS_Get_Container_Goods失败! "..cg_detail ) end
if ( cg_detail ~= nil and #cg_detail > 0 ) then
local item = m3.KeyValueAttrsToObjAttr(cg_detail[1].attrs)
str_html = str_html..gen_attr_div_html( "物料编码", item.S_ITEM_CODE )
str_html = str_html..gen_attr_div_html( "物料名称", item.S_ITEM_NAME )
str_html = str_html..gen_attr_div_html( "批次", item.S_SERIAL_NO )
end
-- 获取库区名称
local area
nRet, area = wms_wh.GetAreaInfo( task.start_area_code )
if (nRet ~= 0) then
strErr = "从内存获取编码'"..task.start_area_code.."'的库区信息失败!"
lua.Error( strLuaDEID, debug.getinfo(1), strErr )
end
str_html = str_html..gen_attr_div_html( "起始库区", '#'..task.start_area_code..'#'..area.name )
str_html = str_html..gen_attr_div_html( "货位", task.start_loc_code )
-- 终点库区
nRet, area = wms_wh.GetAreaInfo( task.end_area_code )
if (nRet ~= 0) then
strErr = "从内存获取编码'"..task.end_area_code.."'的库区信息失败!"
lua.Error( strLuaDEID, debug.getinfo(1), strErr )
end
str_html = str_html..gen_attr_div_html( "终点库区", '#'..task.end_area_code..'#'..area.name )
str_html = str_html..gen_attr_div_html( "货位", task.end_loc_code )
local action = {}
action.action_type = "set_panel_html"
action.value = str_html
lua.Debug( strLuaDEID, debug.getinfo(1), "action! ", action )
nRet, strRetInfo = mobox.setAction( strLuaDEID, '['..lua.table2str(action)..']' )
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end
end